package com.es.dao;

import org.apache.log4j.Logger;

import com.es.dao.factory.SqlMapClientFactory;
import com.es.exception.dao.ESDataAccessException;
import com.es.model.BusinessContact;
import com.es.model.Client;
import com.es.model.Contact;
import com.ibatis.sqlmap.client.SqlMapClient;

public class BusinessContactDAO extends BaseDAO {
	
	private static final Logger log = Logger.getLogger(BusinessContactDAO.class);


	/**
	 * @author Bushra
	 * save business-contact's  model object in the repositary
	 * @param BusinessContact
	 * @return businessContact id generated by db
	 * @throws ESDataAccessException
	 */

	public  int saveBusinessContact(BusinessContact businessContact) throws ESDataAccessException {

		log.info(" inside saveBusinessContact() "); 
		log.info("SAVING Business-Contact..");

		SqlMapClient sqlMap =  SqlMapClientFactory.getSqlMapClient();
		int bctID = -1;

		try {
			bctID =(Integer) sqlMap.insert("businesscontact.abatorgenerated_insert", businessContact);
			log.info("SAVED Business-Contact ID :" + bctID);
			return bctID;
		} catch (Exception e) {
			log.error(e);
			throw new ESDataAccessException(e);

		}
	}



}
